{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [],
   "source": [
    "import pandas\n",
    "import pandas as pd\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9c71223320600934",
   "metadata": {
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [],
   "source": [
    "df = pandas.read_csv(\"result.csv\")\n",
    "# 数据添加列名\n",
    "df.columns = [\"m_id\", \"ep_id\", \"番剧类型\", \"话数\", \"是否完结\", \"评分\", \"season_id\", \"子标题\", \"标题\",\n",
    "              \"点赞\", \"投币数\", \"收藏\", \"分享\", \"评论数\",\n",
    "              \"播放\", \"弹幕数\", \"系列追番人数\",\n",
    "              \"标签\", \"年份\"]\n",
    "df.head(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "320b51b1b3d28226",
   "metadata": {
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [],
   "source": [
    "# 将番剧评分为空填充为零\n",
    "# 源数据 DataFrame, 可以使用 inplace = True 参数:\n",
    "df['评分'].fillna(\"0\", inplace=True)\n",
    "print(df['评分'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7771c41c803154d1",
   "metadata": {
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7d5ea89d358fae74",
   "metadata": {
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [],
   "source": [
    "# 将 年份为 连载中、 敬请期待 的设置为2024\n",
    "df[\"年份\"].replace(\"连载中\", \"2024\", inplace=True)\n",
    "df[\"年份\"].replace(\"敬请期待\", \"2024\", inplace=True)\n",
    "df.head(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6989d54150136d27",
   "metadata": {
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [],
   "source": [
    "# 将话数为空的填充为 连载中\n",
    "df[\"话数\"].fillna(\"连载中\", inplace=True)\n",
    "res = df[\"话数\"] == \"连载中\"\n",
    "print(df[res])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "18c3de243080ff26",
   "metadata": {
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [],
   "source": [
    "# 找到标签含有数字的行，将其年份设置为标签的的数字,并将标签设置为原创\n",
    "res = df[df[\"标签\"].str.contains(r'\\d', na=False)]\n",
    "# print(res)\n",
    "res[\"年份\"] = res['标签']\n",
    "res.loc[:, '标签'] = \"原创\"\n",
    "df.update(res)\n",
    "print(df['年份'].head)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "559c124f586314bf",
   "metadata": {
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [],
   "source": [
    "df.to_csv(\"deal.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "3b46dc42d6b67355",
   "metadata": {
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "69f5a35d4cd800c",
   "metadata": {
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f92246c734418ceb",
   "metadata": {
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2b21e64a754d5fca",
   "metadata": {
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9b42255b952d0ee9",
   "metadata": {
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d203518cb1179602",
   "metadata": {
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1db8bc9e54a0661f",
   "metadata": {
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "cb8fbc5fdcc6a4c8",
   "metadata": {
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "621b5de6dadb57ad",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-17T10:28:07.639495800Z",
     "start_time": "2024-05-17T10:28:07.613491400Z"
    },
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [],
   "source": [
    "from pyecharts.globals import CurrentConfig, NotebookType\n",
    "\n",
    "CurrentConfig.NOTEBOOK_TYPE = NotebookType.JUPYTER_LAB"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "e15084381374e3fc",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-17T10:28:08.440454700Z",
     "start_time": "2024-05-17T10:28:08.345437700Z"
    },
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "   Unnamed: 0      m_id   ep_id  番剧类型       话数  是否完结   评分  season_id  \\\n",
      "0           0  28235125  473500     1     全11话     1  9.7      39433   \n",
      "1           1  28235136  430726     1      全7话     1  9.8      39444   \n",
      "2           2  22718131  267851     1     全26话     1  9.7      26801   \n",
      "3           3  28229899  341309     0     全24话     1  9.7      34430   \n",
      "4           4  20310848  767950     0     全23话     1  9.4      45574   \n",
      "5           5  28237119  508404     0     全25话     1  9.7      41410   \n",
      "6           6  21086686  781703     0     全12话     1  9.7      46085   \n",
      "7           7  21618488  822867     0  更新至第26话     0  0.0      47794   \n",
      "8           8  20140758  741894     1      连载中     0  0.0      44864   \n",
      "9           9  28340196  691450     0     全25话     1  8.9      43622   \n",
      "\n",
      "         子标题              标题       点赞     投币数      收藏     分享    评论数  \\\n",
      "0   斩断鬼所栖身的夜        鬼灭之刃 游郭篇   434688  207881   50027  18872  14433   \n",
      "1   潜入无限的梦境中      鬼灭之刃 无限列车篇   801955  449965  115443  73064  60368   \n",
      "2   谁都斩不断的羁绊            鬼灭之刃   548364  453078  102347  47262  61511   \n",
      "3    我无敌，你随意            咒术回战   886103  330146  108096  42566  23099   \n",
      "4  天上天下，唯我独尊        咒术回战 第二季   229768   96838   38711  22932  10455   \n",
      "5  散装家庭的爆笑喜剧           间谍过家家  1284704  639508  224781  13195  37140   \n",
      "6  瓜神回归，哇酷哇酷       间谍过家家 第二季   185565   66591   24608  17957   5545   \n",
      "7  瓜神回归，哇酷哇酷   间谍过家家 第二季 中配版     9548     691     501    207    668   \n",
      "8  圣诞节的恋爱博弈！  辉夜大小姐想让我告白 剧场版    58332   13101    4206   8618   6454   \n",
      "9  散装家庭的爆笑喜剧       间谍过家家 中配版    60671   11338    9177   3591   2782   \n",
      "\n",
      "           播放       弹幕数    系列追番人数            标签    年份  \n",
      "0   292398438   1086783  16671285  漫画改/热血/战斗/奇幻  2022  \n",
      "1   205203374    981214  16671285  漫画改/热血/战斗/奇幻  2021  \n",
      "2  1015139661  10492864  16671285  漫画改/战斗/热血/声控  2019  \n",
      "3   912213774   5415931  13826082  漫画改/战斗/热血/奇幻  2020  \n",
      "4   267876737    617923  13826082  漫画改/热血/战斗/奇幻  2023  \n",
      "5   798594035   3224004  13076716  漫画改/战斗/搞笑/日常  2022  \n",
      "6   129997033    300442  13076716     漫画改/日常/搞笑  2023  \n",
      "7      557827       839  13076716     漫画改/日常/搞笑  2024  \n",
      "8     4757782      1483  10370339  漫画改/搞笑/恋爱/校园  2024  \n",
      "9    45144057    105130  13076716  漫画改/战斗/搞笑/日常  2022  \n"
     ]
    }
   ],
   "source": [
    "import pandas\n",
    "\n",
    "# 读取处理好的数据\n",
    "df = pandas.read_csv(\"deal.csv\")\n",
    "print(df.head(10))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "69c909b785f57aa2",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-17T10:28:09.307252Z",
     "start_time": "2024-05-17T10:28:09.226737300Z"
    },
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "     Unnamed: 0      m_id   ep_id  番剧类型     话数  是否完结   评分  season_id  \\\n",
      "145         145  28233839  393434     0  全201话     1  9.9      38157   \n",
      "166         166    132112  249469     0   全55话     1  9.9        357   \n",
      "159         159  21087073  779775     0   全28话     1  9.9      46089   \n",
      "102         102  28223483  293001     1   全24话     1  9.9       4213   \n",
      "80           80    102312  234406     1   全12话     1  9.9      24581   \n",
      "319         319      1376  247270     0  全203话     1  9.9       1376   \n",
      "377         377  28234069  396924     0   全52话     1  9.9      38385   \n",
      "252         252      3756   86200     0   全70话     1  9.9       3756   \n",
      "356         356  28233840  397306     0   全64话     1  9.9      38158   \n",
      "149         149  28339735  693247     1   全12话     1  9.9      43164   \n",
      "\n",
      "           子标题                   标题      点赞     投币数      收藏      分享    评论数  \\\n",
      "145  最无厘头的热血动画                   银魂  279775  159441   36374   15769  29576   \n",
      "166  童年经典，百看不厌              猫和老鼠 旧版  747957  548098  149718  234671  41127   \n",
      "159  花海盛开，故人归来               葬送的芙莉莲  310184  137934   69179   52815   8395   \n",
      "102  真是high到不行  JOJO的奇妙冒险 星尘远征军 埃及篇  358130  311822   13539    2327  44219   \n",
      "80   干了这杯可燃乌龙茶                 碧蓝之海  405830  251902   68468  112390  23495   \n",
      "319    我的老师是婴儿   家庭教师HITMAN REBORN!  150964  170501   25173   33398  57553   \n",
      "377  那一年，我变为了光            迪迦奥特曼（中配）  561813  370386   56027   52274  80126   \n",
      "252   初代萌王小樱参上                 百变小樱  227117  185361   61496   83651  81532   \n",
      "356  最无厘头的热血动画               银魂 第二季   66368   30853    6792    3328   2463   \n",
      "149   女孩们的乐队梦想                孤独摇滚！  532807  255123   95931   33558  12006   \n",
      "\n",
      "            播放      弹幕数   系列追番人数            标签    年份  \n",
      "145  489249499  2510596  3947251  漫画改/热血/搞笑/战斗  2021  \n",
      "166  466776340  2575296  3837912      搞笑/日常/少儿  1940  \n",
      "159  248032525   771411  3528671  漫画改/奇幻/治愈/冒险  2023  \n",
      "102  203627310  5296235  9573078  漫画改/战斗/奇幻/冒险  2015  \n",
      "80   197361196  1124766  5151179  社团/漫画改/搞笑/运动  2018  \n",
      "319  196290000  4105603  2073520     漫画改/热血/战斗  2006  \n",
      "377  185041062  1343579  2561436   科幻/战斗/特摄/热血  2021  \n",
      "252  177266330  8704024  4736890      少女/魔法/冒险  1998  \n",
      "356  158229460   696083  3947254  漫画改/热血/搞笑/战斗  2021  \n",
      "149  150064855   751876  3695661     漫画改/音乐/日常  2022  \n"
     ]
    }
   ],
   "source": [
    "# 番剧评分前20的播放数，评论数\n",
    "score = df.sort_values(by=[\"评分\", \"播放\"], ascending=False).head(20)  # ascending升序\n",
    "print(score.head(10))\n",
    "top_score_title = score[\"标题\"].values.tolist()\n",
    "top_score_play = score[\"播放\"].values.tolist()\n",
    "top_score_follow = score[\"系列追番人数\"].values.tolist()\n",
    "# print(top_score_follow)\n",
    "# print(score[\"评分\"]) # 9.9\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "ebbd74ff0904fe73",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-17T10:28:09.999737500Z",
     "start_time": "2024-05-17T10:28:09.978733400Z"
    },
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [
    {
     "data": {
      "application/javascript": [
       "new Promise(function(resolve, reject) {\n",
       "    var script = document.createElement(\"script\");\n",
       "    script.onload = resolve;\n",
       "    script.onerror = reject;\n",
       "    script.src = \"https://assets.pyecharts.org/assets/v5/echarts.min.js\";\n",
       "    document.head.appendChild(script);\n",
       "}).then(() => {\n",
       "\n",
       "});"
      ],
      "text/plain": [
       "<pyecharts.render.display.Javascript at 0x25c1362bf40>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts.charts import Bar\n",
    "from pyecharts import options as opts\n",
    "\n",
    "bar1 = (\n",
    "    Bar()\n",
    "    .add_xaxis(xaxis_data=top_score_title)\n",
    "    .add_yaxis(y_axis=top_score_play,\n",
    "               # itemstyle_opts=opts.ItemStyleOpts(color='cornflowerblue'),  # 颜色\n",
    "               itemstyle_opts=opts.ItemStyleOpts(color='Turquoise'),  # 颜色\n",
    "               series_name='播放数')\n",
    "    # .add_yaxis(y_axis=top_score_follow,\n",
    "    #            itemstyle_opts=opts.ItemStyleOpts(color='cornflowerblue'),  # 颜色\n",
    "    #            series_name='弹幕数')\n",
    "    # .add_yaxis(y_axis=top_score_replay,\n",
    "    #            itemstyle_opts=opts.ItemStyleOpts(color='pink'),  # 颜色\n",
    "    #            series_name='评分人数')\n",
    "    .set_global_opts(\n",
    "        title_opts=opts.TitleOpts(title='b站番剧评分前20播放数', subtitle='评分均为9.9', pos_left=\"20%\"),\n",
    "        xaxis_opts=opts.AxisOpts(axislabel_opts=opts.LabelOpts(rotate=-15)),\n",
    "    )\n",
    "    .set_series_opts(\n",
    "        label_opts=opts.LabelOpts(is_show=False, position=\"top\", color=\"white\", font_size=15),\n",
    "    )\n",
    ")\n",
    "\n",
    "# bar1.render(\"html/score_bar.html\")\n",
    "bar1.load_javascript()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "869818da2b39be48",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-17T10:28:11.160824200Z",
     "start_time": "2024-05-17T10:28:11.132319700Z"
    },
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<!DOCTYPE html>\n",
       "<html>\n",
       "<head>\n",
       "    <meta charset=\"UTF-8\">\n",
       "</head>\n",
       "<body>\n",
       "        <div id=\"b502e06460f24947bd32c0298b2ac53d\" class=\"chart-container\" style=\"width:900px; height:500px; \"></div>\n",
       "    <script>\n",
       "        var chart_b502e06460f24947bd32c0298b2ac53d = echarts.init(\n",
       "            document.getElementById('b502e06460f24947bd32c0298b2ac53d'), 'white', {renderer: 'canvas'});\n",
       "        var option_b502e06460f24947bd32c0298b2ac53d = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"aria\": {\n",
       "        \"enabled\": false\n",
       "    },\n",
       "    \"color\": [\n",
       "        \"#5470c6\",\n",
       "        \"#91cc75\",\n",
       "        \"#fac858\",\n",
       "        \"#ee6666\",\n",
       "        \"#73c0de\",\n",
       "        \"#3ba272\",\n",
       "        \"#fc8452\",\n",
       "        \"#9a60b4\",\n",
       "        \"#ea7ccc\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"\\u64ad\\u653e\\u6570\",\n",
       "            \"legendHoverLink\": true,\n",
       "            \"data\": [\n",
       "                489249499,\n",
       "                466776340,\n",
       "                248032525,\n",
       "                203627310,\n",
       "                197361196,\n",
       "                196290000,\n",
       "                185041062,\n",
       "                177266330,\n",
       "                158229460,\n",
       "                150064855,\n",
       "                139594508,\n",
       "                120905029,\n",
       "                116940957,\n",
       "                111639478,\n",
       "                103081527,\n",
       "                102894482,\n",
       "                102786964,\n",
       "                99041221,\n",
       "                97552197,\n",
       "                94385922\n",
       "            ],\n",
       "            \"realtimeSort\": false,\n",
       "            \"showBackground\": false,\n",
       "            \"stackStrategy\": \"samesign\",\n",
       "            \"cursor\": \"pointer\",\n",
       "            \"barMinHeight\": 0,\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"barGap\": \"30%\",\n",
       "            \"large\": false,\n",
       "            \"largeThreshold\": 400,\n",
       "            \"seriesLayoutBy\": \"column\",\n",
       "            \"datasetIndex\": 0,\n",
       "            \"clip\": true,\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 2,\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"position\": \"top\",\n",
       "                \"color\": \"white\",\n",
       "                \"margin\": 8,\n",
       "                \"fontSize\": 15\n",
       "            },\n",
       "            \"itemStyle\": {\n",
       "                \"color\": \"Turquoise\"\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u64ad\\u653e\\u6570\"\n",
       "            ],\n",
       "            \"selected\": {},\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14,\n",
       "            \"backgroundColor\": \"transparent\",\n",
       "            \"borderColor\": \"#ccc\",\n",
       "            \"borderWidth\": 1,\n",
       "            \"borderRadius\": 0,\n",
       "            \"pageButtonItemGap\": 5,\n",
       "            \"pageButtonPosition\": \"end\",\n",
       "            \"pageFormatter\": \"{current}/{total}\",\n",
       "            \"pageIconColor\": \"#2f4554\",\n",
       "            \"pageIconInactiveColor\": \"#aaa\",\n",
       "            \"pageIconSize\": 15,\n",
       "            \"animationDurationUpdate\": 800,\n",
       "            \"selector\": false,\n",
       "            \"selectorPosition\": \"auto\",\n",
       "            \"selectorItemGap\": 7,\n",
       "            \"selectorButtonGap\": 10\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"enterable\": false,\n",
       "        \"confine\": false,\n",
       "        \"appendToBody\": false,\n",
       "        \"transitionDuration\": 0.4,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5,\n",
       "        \"order\": \"seriesAsc\"\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"axisLabel\": {\n",
       "                \"show\": true,\n",
       "                \"rotate\": -15,\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": true,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"\\u94f6\\u9b42\",\n",
       "                \"\\u732b\\u548c\\u8001\\u9f20 \\u65e7\\u7248\",\n",
       "                \"\\u846c\\u9001\\u7684\\u8299\\u8389\\u83b2\",\n",
       "                \"JOJO\\u7684\\u5947\\u5999\\u5192\\u9669 \\u661f\\u5c18\\u8fdc\\u5f81\\u519b \\u57c3\\u53ca\\u7bc7\",\n",
       "                \"\\u78a7\\u84dd\\u4e4b\\u6d77\",\n",
       "                \"\\u5bb6\\u5ead\\u6559\\u5e08HITMAN REBORN!\",\n",
       "                \"\\u8fea\\u8fe6\\u5965\\u7279\\u66fc\\uff08\\u4e2d\\u914d\\uff09\",\n",
       "                \"\\u767e\\u53d8\\u5c0f\\u6a31\",\n",
       "                \"\\u94f6\\u9b42 \\u7b2c\\u4e8c\\u5b63\",\n",
       "                \"\\u5b64\\u72ec\\u6447\\u6eda\\uff01\",\n",
       "                \"\\u8def\\u4eba\\u8d85\\u80fd100 II(\\u7075\\u80fd\\u767e\\u5206\\u767e \\u7b2c\\u4e8c\\u5b63)\",\n",
       "                \"\\u7cbe\\u7075\\u5b9d\\u53ef\\u68a6 \\u65e0\\u5370\",\n",
       "                \"\\u6392\\u7403\\u5c11\\u5e74\\uff01\\uff01\",\n",
       "                \"Re\\uff1a\\u4ece\\u96f6\\u5f00\\u59cb\\u7684\\u5f02\\u4e16\\u754c\\u751f\\u6d3b \\u7b2c\\u4e8c\\u5b63 \\u540e\\u534a\",\n",
       "                \"\\u8def\\u4eba\\u8d85\\u80fd100 III(\\u7075\\u80fd\\u767e\\u5206\\u767e \\u7b2c\\u4e09\\u5b63)\",\n",
       "                \"\\u5e03\\u83b1\\u6cfd\\u5965\\u7279\\u66fc\",\n",
       "                \"\\u94f6\\u9b42 \\u7b2c\\u4e09\\u5b63\",\n",
       "                \"\\u4e4c\\u9f99\\u6d3e\\u51fa\\u6240\",\n",
       "                \"\\u6e38\\u2606\\u620f\\u2606\\u738b 5D's \\u7b2c\\u56db\\u5b63\",\n",
       "                \"\\u65e5\\u5e38\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": true,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"text\": \"b\\u7ad9\\u756a\\u5267\\u8bc4\\u5206\\u524d20\\u64ad\\u653e\\u6570\",\n",
       "            \"target\": \"blank\",\n",
       "            \"subtext\": \"\\u8bc4\\u5206\\u5747\\u4e3a9.9\",\n",
       "            \"subtarget\": \"blank\",\n",
       "            \"left\": \"20%\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"textAlign\": \"auto\",\n",
       "            \"textVerticalAlign\": \"auto\",\n",
       "            \"triggerEvent\": false\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "        chart_b502e06460f24947bd32c0298b2ac53d.setOption(option_b502e06460f24947bd32c0298b2ac53d);\n",
       "    </script>\n",
       "</body>\n",
       "</html>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x25c137fffd0>"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bar1.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "49ddb2e72adca97f",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-17T10:28:13.639344200Z",
     "start_time": "2024-05-17T10:28:13.622340700Z"
    },
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['声之形', '冰菓', '天气之子', '总之就是非常可爱', '猫和老鼠 旧版', '鬼灭之刃 无限列车篇', '堀与宫村', '国王排名', '咒术回战', '间谍过家家'] [574448, 581929, 588022, 664716, 747957, 801955, 839490, 867309, 886103, 1284704] [732072, 639214, 600394, 311682, 548098, 449965, 450798, 464690, 330146, 639508] [126942, 127539, 120321, 63673, 149718, 115443, 102551, 179072, 108096, 224781]\n",
      "224781\n"
     ]
    }
   ],
   "source": [
    "# 三连（点赞、投币、收藏）前十的番剧推荐\n",
    "san_lian = df.sort_values(by=[\"点赞\", \"投币数\", \"收藏\"], ascending=True).tail(10)\n",
    "\n",
    "san_like = san_lian[\"点赞\"].values.tolist()\n",
    "san_title = san_lian[\"标题\"].values.tolist()\n",
    "san_coin = san_lian[\"投币数\"].values.tolist()\n",
    "san_favorite = san_lian[\"收藏\"].values.tolist()\n",
    "print(san_title, san_like, san_coin, san_favorite)\n",
    "print(max(san_favorite))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "fabc8d8edc648126",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-17T10:28:14.819441800Z",
     "start_time": "2024-05-17T10:28:14.793437Z"
    },
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'JsCode' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[9], line 32\u001b[0m\n\u001b[0;32m     19\u001b[0m bar2\u001b[38;5;241m.\u001b[39madd_yaxis(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m投币数\u001b[39m\u001b[38;5;124m'\u001b[39m, san_coin, stack\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mstack2\u001b[39m\u001b[38;5;124m\"\u001b[39m, label_opts\u001b[38;5;241m=\u001b[39mopts\u001b[38;5;241m.\u001b[39mLabelOpts(is_show\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m), color\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mLightSeaGreen\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m     20\u001b[0m bar2\u001b[38;5;241m.\u001b[39mset_global_opts(\n\u001b[0;32m     21\u001b[0m \n\u001b[0;32m     22\u001b[0m     title_opts\u001b[38;5;241m=\u001b[39mopts\u001b[38;5;241m.\u001b[39mTitleOpts(title\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m三连前十的番剧推荐\u001b[39m\u001b[38;5;124m'\u001b[39m, subtitle\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m三连（即点赞、投币、收藏）\u001b[39m\u001b[38;5;124m'\u001b[39m, pos_left\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m10\u001b[39m\u001b[38;5;124m%\u001b[39m\u001b[38;5;124m\"\u001b[39m),\n\u001b[1;32m   (...)\u001b[0m\n\u001b[0;32m     28\u001b[0m     \u001b[38;5;66;03m# datazoom_opts=opts.DataZoomOpts(),# 下面区域滑动\u001b[39;00m\n\u001b[0;32m     29\u001b[0m )\n\u001b[0;32m     30\u001b[0m bar2\u001b[38;5;241m.\u001b[39mset_series_opts(\n\u001b[0;32m     31\u001b[0m     label_opts\u001b[38;5;241m=\u001b[39mopts\u001b[38;5;241m.\u001b[39mLabelOpts(position\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124minside\u001b[39m\u001b[38;5;124m\"\u001b[39m, color\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mwhite\u001b[39m\u001b[38;5;124m\"\u001b[39m, font_size\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m15\u001b[39m),\n\u001b[1;32m---> 32\u001b[0m     itemstyle_opts\u001b[38;5;241m=\u001b[39mopts\u001b[38;5;241m.\u001b[39mItemStyleOpts(color\u001b[38;5;241m=\u001b[39m\u001b[43mJsCode\u001b[49m(color_js)),\n\u001b[0;32m     33\u001b[0m )\n\u001b[0;32m     35\u001b[0m bar2\u001b[38;5;241m.\u001b[39mextend_axis(yaxis\u001b[38;5;241m=\u001b[39mopts\u001b[38;5;241m.\u001b[39mAxisOpts(\n\u001b[0;32m     36\u001b[0m     name\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m收藏数\u001b[39m\u001b[38;5;124m'\u001b[39m, min_\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m0\u001b[39m, max_\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mmax\u001b[39m(san_favorite),\n\u001b[0;32m     37\u001b[0m     \u001b[38;5;66;03m# interval=5,\u001b[39;00m\n\u001b[0;32m     38\u001b[0m     \u001b[38;5;66;03m# axislabel_opts=opts.LabelOpts(formatter='{value} 个')\u001b[39;00m\n\u001b[0;32m     39\u001b[0m ))\n\u001b[0;32m     41\u001b[0m line \u001b[38;5;241m=\u001b[39m Line()\n",
      "\u001b[1;31mNameError\u001b[0m: name 'JsCode' is not defined"
     ]
    }
   ],
   "source": [
    "from pyecharts.charts import Bar, Line\n",
    "from pyecharts import options as opts\n",
    "\n",
    "color_js = \"\"\"new echarts.graphic.LinearGradient(0, 0, 0, 1,\n",
    "        [{offset: 1, color: '#9400D3'}, {offset: 0, color: '#B8860B'}], false)\"\"\"\n",
    "\n",
    "# Bar(init_opts=opts.InitOpts(width=\"900px\", height=\"500px\"))\n",
    "# .add_xaxis(data[\"区域\"].tolist())\n",
    "# .add_yaxis(\"上衣销量\", data[\"上衣销量\"].tolist(), stack=\"stack1\", color=\"Turquoise\")\n",
    "# .add_yaxis(\"裤子销量\", data[\"裤子销量\"].tolist(), stack=\"stack2\", color=\"LightSeaGreen\")\n",
    "# .add_yaxis(\"鞋袜销量\", data[\"鞋袜销量\"].tolist(), stack=\"stack3\", color=\"DarkCyan\")\n",
    "# .set_series_opts(\n",
    "#     label_opts=opts.LabelOpts(position=\"inside\", color=\"white\", font_size=15),\n",
    "#     itemstyle_opts=opts.ItemStyleOpts(color=JsCode(color_js)),\n",
    "\n",
    "bar2 = Bar()\n",
    "bar2.add_xaxis(san_title)\n",
    "bar2.add_yaxis('点赞数', san_like, stack=\"stack1\", label_opts=opts.LabelOpts(is_show=False), color=\"Turquoise\")\n",
    "bar2.add_yaxis('投币数', san_coin, stack=\"stack2\", label_opts=opts.LabelOpts(is_show=False), color=\"LightSeaGreen\")\n",
    "bar2.set_global_opts(\n",
    "\n",
    "    title_opts=opts.TitleOpts(title='三连前十的番剧推荐', subtitle='三连（即点赞、投币、收藏）', pos_left=\"10%\"),\n",
    "    tooltip_opts=opts.TooltipOpts(is_show=True, trigger='axis', axis_pointer_type='cross'),\n",
    "    xaxis_opts=opts.AxisOpts(type_='category',\n",
    "                             axispointer_opts=opts.AxisPointerOpts(is_show=True, type_='shadow'),\n",
    "                             axislabel_opts=opts.LabelOpts(rotate=-45)\n",
    "                             ),\n",
    "    # datazoom_opts=opts.DataZoomOpts(),# 下面区域滑动\n",
    ")\n",
    "bar2.set_series_opts(\n",
    "    label_opts=opts.LabelOpts(position=\"inside\", color=\"white\", font_size=15),\n",
    "    itemstyle_opts=opts.ItemStyleOpts(color=JsCode(color_js)),\n",
    ")\n",
    "\n",
    "bar2.extend_axis(yaxis=opts.AxisOpts(\n",
    "    name='收藏数', min_=0, max_=max(san_favorite),\n",
    "    # interval=5,\n",
    "    # axislabel_opts=opts.LabelOpts(formatter='{value} 个')\n",
    "))\n",
    "\n",
    "line = Line()\n",
    "line.add_xaxis(san_title)\n",
    "line.add_yaxis('收藏数',\n",
    "               san_favorite,\n",
    "               yaxis_index=1,\n",
    "               label_opts=opts.LabelOpts(is_show=False)\n",
    "               )\n",
    "\n",
    "bar2.overlap(line)  # 合并图\n",
    "bar2.load_javascript()\n",
    "# bar2.render(\"html/san.html\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "4e949b2ba3548d58",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-17T10:28:15.899258900Z",
     "start_time": "2024-05-17T10:28:15.871754Z"
    },
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<!DOCTYPE html>\n",
       "<html>\n",
       "<head>\n",
       "    <meta charset=\"UTF-8\">\n",
       "</head>\n",
       "<body>\n",
       "        <div id=\"3b0ba965bef74f09a561779e013d8ec8\" class=\"chart-container\" style=\"width:900px; height:500px; \"></div>\n",
       "    <script>\n",
       "        var chart_3b0ba965bef74f09a561779e013d8ec8 = echarts.init(\n",
       "            document.getElementById('3b0ba965bef74f09a561779e013d8ec8'), 'white', {renderer: 'canvas'});\n",
       "        var option_3b0ba965bef74f09a561779e013d8ec8 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"aria\": {\n",
       "        \"enabled\": false\n",
       "    },\n",
       "    \"color\": [\n",
       "        \"Turquoise\",\n",
       "        \"LightSeaGreen\",\n",
       "        \"#5470c6\",\n",
       "        \"#91cc75\",\n",
       "        \"#fac858\",\n",
       "        \"#ee6666\",\n",
       "        \"#73c0de\",\n",
       "        \"#3ba272\",\n",
       "        \"#fc8452\",\n",
       "        \"#9a60b4\",\n",
       "        \"#ea7ccc\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"\\u70b9\\u8d5e\\u6570\",\n",
       "            \"legendHoverLink\": true,\n",
       "            \"data\": [\n",
       "                574448,\n",
       "                581929,\n",
       "                588022,\n",
       "                664716,\n",
       "                747957,\n",
       "                801955,\n",
       "                839490,\n",
       "                867309,\n",
       "                886103,\n",
       "                1284704\n",
       "            ],\n",
       "            \"realtimeSort\": false,\n",
       "            \"showBackground\": false,\n",
       "            \"stack\": \"stack1\",\n",
       "            \"stackStrategy\": \"samesign\",\n",
       "            \"cursor\": \"pointer\",\n",
       "            \"barMinHeight\": 0,\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"barGap\": \"30%\",\n",
       "            \"large\": false,\n",
       "            \"largeThreshold\": 400,\n",
       "            \"seriesLayoutBy\": \"column\",\n",
       "            \"datasetIndex\": 0,\n",
       "            \"clip\": true,\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 2,\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"\\u6295\\u5e01\\u6570\",\n",
       "            \"legendHoverLink\": true,\n",
       "            \"data\": [\n",
       "                732072,\n",
       "                639214,\n",
       "                600394,\n",
       "                311682,\n",
       "                548098,\n",
       "                449965,\n",
       "                450798,\n",
       "                464690,\n",
       "                330146,\n",
       "                639508\n",
       "            ],\n",
       "            \"realtimeSort\": false,\n",
       "            \"showBackground\": false,\n",
       "            \"stack\": \"stack2\",\n",
       "            \"stackStrategy\": \"samesign\",\n",
       "            \"cursor\": \"pointer\",\n",
       "            \"barMinHeight\": 0,\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"barGap\": \"30%\",\n",
       "            \"large\": false,\n",
       "            \"largeThreshold\": 400,\n",
       "            \"seriesLayoutBy\": \"column\",\n",
       "            \"datasetIndex\": 0,\n",
       "            \"clip\": true,\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 2,\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u70b9\\u8d5e\\u6570\",\n",
       "                \"\\u6295\\u5e01\\u6570\"\n",
       "            ],\n",
       "            \"selected\": {},\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14,\n",
       "            \"backgroundColor\": \"transparent\",\n",
       "            \"borderColor\": \"#ccc\",\n",
       "            \"borderWidth\": 1,\n",
       "            \"borderRadius\": 0,\n",
       "            \"pageButtonItemGap\": 5,\n",
       "            \"pageButtonPosition\": \"end\",\n",
       "            \"pageFormatter\": \"{current}/{total}\",\n",
       "            \"pageIconColor\": \"#2f4554\",\n",
       "            \"pageIconInactiveColor\": \"#aaa\",\n",
       "            \"pageIconSize\": 15,\n",
       "            \"animationDurationUpdate\": 800,\n",
       "            \"selector\": false,\n",
       "            \"selectorPosition\": \"auto\",\n",
       "            \"selectorItemGap\": 7,\n",
       "            \"selectorButtonGap\": 10\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"axis\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"cross\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"enterable\": false,\n",
       "        \"confine\": false,\n",
       "        \"appendToBody\": false,\n",
       "        \"transitionDuration\": 0.4,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5,\n",
       "        \"order\": \"seriesAsc\"\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"type\": \"category\",\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"axisLabel\": {\n",
       "                \"show\": true,\n",
       "                \"rotate\": -45,\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"axisPointer\": {\n",
       "                \"show\": true,\n",
       "                \"type\": \"shadow\",\n",
       "                \"triggerTooltip\": true,\n",
       "                \"triggerOn\": \"mousemove|click\"\n",
       "            },\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": true,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"\\u58f0\\u4e4b\\u5f62\",\n",
       "                \"\\u51b0\\u83d3\",\n",
       "                \"\\u5929\\u6c14\\u4e4b\\u5b50\",\n",
       "                \"\\u603b\\u4e4b\\u5c31\\u662f\\u975e\\u5e38\\u53ef\\u7231\",\n",
       "                \"\\u732b\\u548c\\u8001\\u9f20 \\u65e7\\u7248\",\n",
       "                \"\\u9b3c\\u706d\\u4e4b\\u5203 \\u65e0\\u9650\\u5217\\u8f66\\u7bc7\",\n",
       "                \"\\u5800\\u4e0e\\u5bab\\u6751\",\n",
       "                \"\\u56fd\\u738b\\u6392\\u540d\",\n",
       "                \"\\u5492\\u672f\\u56de\\u6218\",\n",
       "                \"\\u95f4\\u8c0d\\u8fc7\\u5bb6\\u5bb6\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": true,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"text\": \"\\u4e09\\u8fde\\u524d\\u5341\\u7684\\u756a\\u5267\\u63a8\\u8350\",\n",
       "            \"target\": \"blank\",\n",
       "            \"subtext\": \"\\u4e09\\u8fde\\uff08\\u5373\\u70b9\\u8d5e\\u3001\\u6295\\u5e01\\u3001\\u6536\\u85cf\\uff09\",\n",
       "            \"subtarget\": \"blank\",\n",
       "            \"left\": \"10%\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"textAlign\": \"auto\",\n",
       "            \"textVerticalAlign\": \"auto\",\n",
       "            \"triggerEvent\": false\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "        chart_3b0ba965bef74f09a561779e013d8ec8.setOption(option_3b0ba965bef74f09a561779e013d8ec8);\n",
       "    </script>\n",
       "</body>\n",
       "</html>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x25c13a3d0f0>"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bar2.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "e71f8717a96994c",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-17T10:28:17.433710200Z",
     "start_time": "2024-05-17T10:28:17.394203800Z"
    },
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['漫画改', '热血', '战斗', '奇幻', '漫画改', '热血', '战斗', '奇幻', '漫画改', '战斗']\n",
      "奇幻         997\n",
      "热血         761\n",
      "科幻         700\n",
      "日常         683\n",
      "战斗         657\n",
      "漫画改        542\n",
      "原创         531\n",
      "搞笑         530\n",
      "少儿         455\n",
      "萌系         419\n",
      "治愈         397\n",
      "冒险         383\n",
      "校园         324\n",
      "架空         252\n",
      "少女         247\n",
      "小说改        227\n",
      "恋爱         203\n",
      "机战         159\n",
      "运动         154\n",
      "泡面         150\n",
      "游戏改        125\n",
      "穿越         123\n",
      "时泪         118\n",
      "音乐         114\n",
      "魔法         110\n",
      "励志          98\n",
      "声控          93\n",
      "偶像          86\n",
      "智斗          86\n",
      "推理          74\n",
      "社团          68\n",
      "动画          68\n",
      "历史          64\n",
      "特摄          61\n",
      "催泪          60\n",
      "悬疑          53\n",
      "乙女          52\n",
      "神魔          39\n",
      "职场          39\n",
      "美食          38\n",
      "动作          13\n",
      "剧情          12\n",
      "萝莉           8\n",
      "喜剧           7\n",
      "爱情           5\n",
      "布袋戏          4\n",
      "武侠           4\n",
      "惊悚           3\n",
      "恐怖           2\n",
      "жҗһз¬‘       1\n",
      "ж—ҘеёёВ      1\n",
      "зғӯиЎҖ       1\n",
      "жҲҳж–—       1\n",
      "еҶ’йҷ©В      1\n",
      "歌舞           1\n",
      "犯罪           1\n",
      "Name: count, dtype: int64\n",
      "['奇幻', '热血', '科幻', '日常', '战斗', '漫画改', '原创', '搞笑', '少儿', '萌系', '治愈', '冒险', '校园', '架空', '少女', '小说改', '恋爱', '机战', '运动', '泡面', '游戏改', '穿越', '时泪', '音乐', '魔法', '励志', '声控', '偶像', '智斗', '推理', '社团', '动画', '历史', '特摄', '催泪', '悬疑', '乙女', '其他']\n",
      "[997, 761, 700, 683, 657, 542, 531, 530, 455, 419, 397, 383, 324, 252, 247, 227, 203, 159, 154, 150, 125, 123, 118, 114, 110, 98, 93, 86, 86, 74, 68, 68, 64, 61, 60, 53, 52, 181]\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "\n",
    "# B站番剧各标签占比\n",
    "labels = df[\"标签\"].values.tolist()\n",
    "# print(labels)  # '少儿', '漫画改/搞笑/少儿', '漫画改',\n",
    "list = []\n",
    "for item in labels:\n",
    "    list.extend(str(item).split(\"/\"))\n",
    "print(list[0:10])  # ['原创', '少儿', ......'原创', '少儿']\n",
    "# 统计标签出现频次\n",
    "series = pd.Series(list)\n",
    "count = series.value_counts()\n",
    "print(count)\n",
    "\"\"\"\n",
    "奇幻         997\n",
    "热血         761\n",
    "...\n",
    "\"\"\"\n",
    "type_list = []\n",
    "value_list = []\n",
    "types_all = []\n",
    "values_all = []\n",
    "other = 0\n",
    "for index, value in count.items():\n",
    "    types_all.append(index)\n",
    "    values_all.append(value)\n",
    "    if value > 50:\n",
    "        type_list.append(index)\n",
    "        value_list.append(value)\n",
    "    else:\n",
    "        other += value\n",
    "type_list.append(\"其他\")\n",
    "value_list.append(other)\n",
    "\n",
    "print(type_list)\n",
    "print(value_list)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "87ff5cdca2e6bf2c",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-17T10:28:18.608186600Z",
     "start_time": "2024-05-17T10:28:18.581368700Z"
    },
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [],
   "source": [
    "from pyecharts.charts import Pie\n",
    "from pyecharts import options as opts\n",
    "\n",
    "# b站各标签电影占比\n",
    "pie = (\n",
    "    Pie()\n",
    "    .add(\n",
    "        '人数',\n",
    "        [[m, n] for m, n in zip(type_list, value_list)],\n",
    "        radius=['25%', '80%'],\n",
    "        center=['50%', '50%'],\n",
    "        rosetype='radius',\n",
    "        label_opts=opts.LabelOpts(is_show=False),\n",
    "    )\n",
    "    .set_global_opts(title_opts=opts.TitleOpts(title='bilibili各标签番剧占比', pos_left='40%'),\n",
    "                     legend_opts=opts.LegendOpts(type_=\"scroll\", pos_top=\"20%\", pos_left=\"85%\",\n",
    "                                                 orient=\"vertical\"))  # 图例配置项\n",
    "    .set_series_opts(label_opts=opts.LabelOpts(formatter=\"{b}:{c} {d}%\"))  # 显示百分比\n",
    ")\n",
    "# pie.render(\"html/label_pie.html\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "a872723ed6d9c25f",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-17T10:28:20.556501800Z",
     "start_time": "2024-05-17T10:28:20.520495800Z"
    },
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<!DOCTYPE html>\n",
       "<html>\n",
       "<head>\n",
       "    <meta charset=\"UTF-8\">\n",
       "</head>\n",
       "<body>\n",
       "        <div id=\"64b0b25d866b48039987322c1fc9b64c\" class=\"chart-container\" style=\"width:900px; height:500px; \"></div>\n",
       "    <script>\n",
       "        var chart_64b0b25d866b48039987322c1fc9b64c = echarts.init(\n",
       "            document.getElementById('64b0b25d866b48039987322c1fc9b64c'), 'white', {renderer: 'canvas'});\n",
       "        var option_64b0b25d866b48039987322c1fc9b64c = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"aria\": {\n",
       "        \"enabled\": false\n",
       "    },\n",
       "    \"color\": [\n",
       "        \"#5470c6\",\n",
       "        \"#91cc75\",\n",
       "        \"#fac858\",\n",
       "        \"#ee6666\",\n",
       "        \"#73c0de\",\n",
       "        \"#3ba272\",\n",
       "        \"#fc8452\",\n",
       "        \"#9a60b4\",\n",
       "        \"#ea7ccc\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"pie\",\n",
       "            \"name\": \"\\u4eba\\u6570\",\n",
       "            \"colorBy\": \"data\",\n",
       "            \"legendHoverLink\": true,\n",
       "            \"selectedMode\": false,\n",
       "            \"selectedOffset\": 10,\n",
       "            \"clockwise\": true,\n",
       "            \"startAngle\": 90,\n",
       "            \"minAngle\": 0,\n",
       "            \"minShowLabelAngle\": 0,\n",
       "            \"avoidLabelOverlap\": true,\n",
       "            \"stillShowZeroSum\": true,\n",
       "            \"percentPrecision\": 2,\n",
       "            \"showEmptyCircle\": true,\n",
       "            \"emptyCircleStyle\": {\n",
       "                \"color\": \"lightgray\",\n",
       "                \"borderColor\": \"#000\",\n",
       "                \"borderWidth\": 0,\n",
       "                \"borderType\": \"solid\",\n",
       "                \"borderDashOffset\": 0,\n",
       "                \"borderCap\": \"butt\",\n",
       "                \"borderJoin\": \"bevel\",\n",
       "                \"borderMiterLimit\": 10,\n",
       "                \"opacity\": 1\n",
       "            },\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u5947\\u5e7b\",\n",
       "                    \"value\": 997\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u70ed\\u8840\",\n",
       "                    \"value\": 761\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u79d1\\u5e7b\",\n",
       "                    \"value\": 700\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u65e5\\u5e38\",\n",
       "                    \"value\": 683\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6218\\u6597\",\n",
       "                    \"value\": 657\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6f2b\\u753b\\u6539\",\n",
       "                    \"value\": 542\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u539f\\u521b\",\n",
       "                    \"value\": 531\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u641e\\u7b11\",\n",
       "                    \"value\": 530\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5c11\\u513f\",\n",
       "                    \"value\": 455\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u840c\\u7cfb\",\n",
       "                    \"value\": 419\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6cbb\\u6108\",\n",
       "                    \"value\": 397\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5192\\u9669\",\n",
       "                    \"value\": 383\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6821\\u56ed\",\n",
       "                    \"value\": 324\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u67b6\\u7a7a\",\n",
       "                    \"value\": 252\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5c11\\u5973\",\n",
       "                    \"value\": 247\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5c0f\\u8bf4\\u6539\",\n",
       "                    \"value\": 227\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u604b\\u7231\",\n",
       "                    \"value\": 203\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u673a\\u6218\",\n",
       "                    \"value\": 159\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8fd0\\u52a8\",\n",
       "                    \"value\": 154\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6ce1\\u9762\",\n",
       "                    \"value\": 150\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6e38\\u620f\\u6539\",\n",
       "                    \"value\": 125\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u7a7f\\u8d8a\",\n",
       "                    \"value\": 123\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u65f6\\u6cea\",\n",
       "                    \"value\": 118\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u97f3\\u4e50\",\n",
       "                    \"value\": 114\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9b54\\u6cd5\",\n",
       "                    \"value\": 110\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u52b1\\u5fd7\",\n",
       "                    \"value\": 98\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u58f0\\u63a7\",\n",
       "                    \"value\": 93\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5076\\u50cf\",\n",
       "                    \"value\": 86\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u667a\\u6597\",\n",
       "                    \"value\": 86\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u63a8\\u7406\",\n",
       "                    \"value\": 74\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u793e\\u56e2\",\n",
       "                    \"value\": 68\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u52a8\\u753b\",\n",
       "                    \"value\": 68\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5386\\u53f2\",\n",
       "                    \"value\": 64\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u7279\\u6444\",\n",
       "                    \"value\": 61\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u50ac\\u6cea\",\n",
       "                    \"value\": 60\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u60ac\\u7591\",\n",
       "                    \"value\": 53\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u4e59\\u5973\",\n",
       "                    \"value\": 52\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5176\\u4ed6\",\n",
       "                    \"value\": 181\n",
       "                }\n",
       "            ],\n",
       "            \"radius\": [\n",
       "                \"25%\",\n",
       "                \"80%\"\n",
       "            ],\n",
       "            \"center\": [\n",
       "                \"50%\",\n",
       "                \"50%\"\n",
       "            ],\n",
       "            \"roseType\": \"radius\",\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"margin\": 8,\n",
       "                \"formatter\": \"{b}:{c} {d}%\"\n",
       "            },\n",
       "            \"labelLine\": {\n",
       "                \"show\": true,\n",
       "                \"showAbove\": false,\n",
       "                \"length\": 15,\n",
       "                \"length2\": 15,\n",
       "                \"smooth\": false,\n",
       "                \"minTurnAngle\": 90,\n",
       "                \"maxSurfaceAngle\": 90\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u5947\\u5e7b\",\n",
       "                \"\\u70ed\\u8840\",\n",
       "                \"\\u79d1\\u5e7b\",\n",
       "                \"\\u65e5\\u5e38\",\n",
       "                \"\\u6218\\u6597\",\n",
       "                \"\\u6f2b\\u753b\\u6539\",\n",
       "                \"\\u539f\\u521b\",\n",
       "                \"\\u641e\\u7b11\",\n",
       "                \"\\u5c11\\u513f\",\n",
       "                \"\\u840c\\u7cfb\",\n",
       "                \"\\u6cbb\\u6108\",\n",
       "                \"\\u5192\\u9669\",\n",
       "                \"\\u6821\\u56ed\",\n",
       "                \"\\u67b6\\u7a7a\",\n",
       "                \"\\u5c11\\u5973\",\n",
       "                \"\\u5c0f\\u8bf4\\u6539\",\n",
       "                \"\\u604b\\u7231\",\n",
       "                \"\\u673a\\u6218\",\n",
       "                \"\\u8fd0\\u52a8\",\n",
       "                \"\\u6ce1\\u9762\",\n",
       "                \"\\u6e38\\u620f\\u6539\",\n",
       "                \"\\u7a7f\\u8d8a\",\n",
       "                \"\\u65f6\\u6cea\",\n",
       "                \"\\u97f3\\u4e50\",\n",
       "                \"\\u9b54\\u6cd5\",\n",
       "                \"\\u52b1\\u5fd7\",\n",
       "                \"\\u58f0\\u63a7\",\n",
       "                \"\\u5076\\u50cf\",\n",
       "                \"\\u667a\\u6597\",\n",
       "                \"\\u63a8\\u7406\",\n",
       "                \"\\u793e\\u56e2\",\n",
       "                \"\\u52a8\\u753b\",\n",
       "                \"\\u5386\\u53f2\",\n",
       "                \"\\u7279\\u6444\",\n",
       "                \"\\u50ac\\u6cea\",\n",
       "                \"\\u60ac\\u7591\",\n",
       "                \"\\u4e59\\u5973\",\n",
       "                \"\\u5176\\u4ed6\"\n",
       "            ],\n",
       "            \"selected\": {},\n",
       "            \"type\": \"scroll\",\n",
       "            \"show\": true,\n",
       "            \"left\": \"85%\",\n",
       "            \"top\": \"20%\",\n",
       "            \"orient\": \"vertical\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14,\n",
       "            \"backgroundColor\": \"transparent\",\n",
       "            \"borderColor\": \"#ccc\",\n",
       "            \"borderWidth\": 1,\n",
       "            \"borderRadius\": 0,\n",
       "            \"pageButtonItemGap\": 5,\n",
       "            \"pageButtonPosition\": \"end\",\n",
       "            \"pageFormatter\": \"{current}/{total}\",\n",
       "            \"pageIconColor\": \"#2f4554\",\n",
       "            \"pageIconInactiveColor\": \"#aaa\",\n",
       "            \"pageIconSize\": 15,\n",
       "            \"animationDurationUpdate\": 800,\n",
       "            \"selector\": false,\n",
       "            \"selectorPosition\": \"auto\",\n",
       "            \"selectorItemGap\": 7,\n",
       "            \"selectorButtonGap\": 10\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"enterable\": false,\n",
       "        \"confine\": false,\n",
       "        \"appendToBody\": false,\n",
       "        \"transitionDuration\": 0.4,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5,\n",
       "        \"order\": \"seriesAsc\"\n",
       "    },\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"text\": \"bilibili\\u5404\\u6807\\u7b7e\\u756a\\u5267\\u5360\\u6bd4\",\n",
       "            \"target\": \"blank\",\n",
       "            \"subtarget\": \"blank\",\n",
       "            \"left\": \"40%\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"textAlign\": \"auto\",\n",
       "            \"textVerticalAlign\": \"auto\",\n",
       "            \"triggerEvent\": false\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "        chart_64b0b25d866b48039987322c1fc9b64c.setOption(option_64b0b25d866b48039987322c1fc9b64c);\n",
       "    </script>\n",
       "</body>\n",
       "</html>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x25c13bf5d80>"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pie.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "e9a04cbb1cc19116",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-17T10:28:22.071495200Z",
     "start_time": "2024-05-17T10:28:22.051991800Z"
    },
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [
    {
     "data": {
      "application/javascript": [
       "new Promise(function(resolve, reject) {\n",
       "    var script = document.createElement(\"script\");\n",
       "    script.onload = resolve;\n",
       "    script.onerror = reject;\n",
       "    script.src = \"https://assets.pyecharts.org/assets/v5/echarts.min.js\";\n",
       "    document.head.appendChild(script);\n",
       "}).then(() => {\n",
       "new Promise(function(resolve, reject) {\n",
       "    var script = document.createElement(\"script\");\n",
       "    script.onload = resolve;\n",
       "    script.onerror = reject;\n",
       "    script.src = \"https://assets.pyecharts.org/assets/v5/echarts-wordcloud.min.js\";\n",
       "    document.head.appendChild(script);\n",
       "}).then(() => {\n",
       "\n",
       "});\n",
       "});"
      ],
      "text/plain": [
       "<pyecharts.render.display.Javascript at 0x1ce5e5dd330>"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts.charts import WordCloud\n",
    "\n",
    "# 词云图\n",
    "cloudObj = WordCloud()\n",
    "# shap默认为cicrle，其他形状有circle, cardioid, diamond, , triangle, pentagon, star\n",
    "cloudObj.add('', [(type, value) for type, value in zip(type_list, value_list)], shape='triangle')\n",
    "cloudObj.set_global_opts(title_opts=opts.TitleOpts(title=\"bilibili番剧关键字\", pos_left=\"10%\"))\n",
    "# cloudObj.render('html/word.html')\n",
    "cloudObj.load_javascript()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "c76559e9a487eed2",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-17T10:28:29.328062300Z",
     "start_time": "2024-05-17T10:28:29.247548200Z"
    },
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<!DOCTYPE html>\n",
       "<html>\n",
       "<head>\n",
       "    <meta charset=\"UTF-8\">\n",
       "</head>\n",
       "<body>\n",
       "        <div id=\"dcb7aa1dc87b4eb09f84a1c6be9dc04f\" class=\"chart-container\" style=\"width:900px; height:500px; \"></div>\n",
       "    <script>\n",
       "        var chart_dcb7aa1dc87b4eb09f84a1c6be9dc04f = echarts.init(\n",
       "            document.getElementById('dcb7aa1dc87b4eb09f84a1c6be9dc04f'), 'white', {renderer: 'canvas'});\n",
       "        var option_dcb7aa1dc87b4eb09f84a1c6be9dc04f = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"aria\": {\n",
       "        \"enabled\": false\n",
       "    },\n",
       "    \"color\": [\n",
       "        \"#5470c6\",\n",
       "        \"#91cc75\",\n",
       "        \"#fac858\",\n",
       "        \"#ee6666\",\n",
       "        \"#73c0de\",\n",
       "        \"#3ba272\",\n",
       "        \"#fc8452\",\n",
       "        \"#9a60b4\",\n",
       "        \"#ea7ccc\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"wordCloud\",\n",
       "            \"shape\": \"triangle\",\n",
       "            \"rotationRange\": [\n",
       "                0,\n",
       "                0\n",
       "            ],\n",
       "            \"rotationStep\": 45,\n",
       "            \"girdSize\": 20,\n",
       "            \"sizeRange\": [\n",
       "                12,\n",
       "                60\n",
       "            ],\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u5947\\u5e7b\",\n",
       "                    \"value\": 997,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(2,81,127)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u70ed\\u8840\",\n",
       "                    \"value\": 761,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(13,23,126)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u79d1\\u5e7b\",\n",
       "                    \"value\": 700,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(115,45,3)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u65e5\\u5e38\",\n",
       "                    \"value\": 683,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(104,129,89)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6218\\u6597\",\n",
       "                    \"value\": 657,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(138,50,107)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6f2b\\u753b\\u6539\",\n",
       "                    \"value\": 542,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(89,117,79)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u539f\\u521b\",\n",
       "                    \"value\": 531,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(155,31,144)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u641e\\u7b11\",\n",
       "                    \"value\": 530,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(139,135,48)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5c11\\u513f\",\n",
       "                    \"value\": 455,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(135,107,44)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u840c\\u7cfb\",\n",
       "                    \"value\": 419,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(98,109,16)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6cbb\\u6108\",\n",
       "                    \"value\": 397,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(137,70,100)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5192\\u9669\",\n",
       "                    \"value\": 383,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(30,39,15)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6821\\u56ed\",\n",
       "                    \"value\": 324,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(103,97,118)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u67b6\\u7a7a\",\n",
       "                    \"value\": 252,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(79,141,26)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5c11\\u5973\",\n",
       "                    \"value\": 247,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(90,32,77)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5c0f\\u8bf4\\u6539\",\n",
       "                    \"value\": 227,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(150,89,117)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u604b\\u7231\",\n",
       "                    \"value\": 203,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(23,56,48)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u673a\\u6218\",\n",
       "                    \"value\": 159,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(96,143,131)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8fd0\\u52a8\",\n",
       "                    \"value\": 154,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(74,3,72)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6ce1\\u9762\",\n",
       "                    \"value\": 150,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(73,32,84)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6e38\\u620f\\u6539\",\n",
       "                    \"value\": 125,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(37,115,38)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u7a7f\\u8d8a\",\n",
       "                    \"value\": 123,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(55,82,75)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u65f6\\u6cea\",\n",
       "                    \"value\": 118,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(88,4,64)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u97f3\\u4e50\",\n",
       "                    \"value\": 114,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(91,113,137)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9b54\\u6cd5\",\n",
       "                    \"value\": 110,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(91,48,73)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u52b1\\u5fd7\",\n",
       "                    \"value\": 98,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(101,31,72)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u58f0\\u63a7\",\n",
       "                    \"value\": 93,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(116,133,148)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5076\\u50cf\",\n",
       "                    \"value\": 86,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(118,126,77)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u667a\\u6597\",\n",
       "                    \"value\": 86,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(137,106,141)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u63a8\\u7406\",\n",
       "                    \"value\": 74,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(50,36,91)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u793e\\u56e2\",\n",
       "                    \"value\": 68,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(13,116,102)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u52a8\\u753b\",\n",
       "                    \"value\": 68,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(4,12,137)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5386\\u53f2\",\n",
       "                    \"value\": 64,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(114,10,23)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u7279\\u6444\",\n",
       "                    \"value\": 61,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(15,74,74)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u50ac\\u6cea\",\n",
       "                    \"value\": 60,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(119,57,7)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u60ac\\u7591\",\n",
       "                    \"value\": 53,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(2,97,125)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u4e59\\u5973\",\n",
       "                    \"value\": 52,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(42,113,31)\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5176\\u4ed6\",\n",
       "                    \"value\": 181,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"rgb(158,104,16)\"\n",
       "                    }\n",
       "                }\n",
       "            ],\n",
       "            \"drawOutOfBound\": false,\n",
       "            \"textStyle\": {\n",
       "                \"emphasis\": {}\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [],\n",
       "            \"selected\": {},\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14,\n",
       "            \"backgroundColor\": \"transparent\",\n",
       "            \"borderColor\": \"#ccc\",\n",
       "            \"borderWidth\": 1,\n",
       "            \"borderRadius\": 0,\n",
       "            \"pageButtonItemGap\": 5,\n",
       "            \"pageButtonPosition\": \"end\",\n",
       "            \"pageFormatter\": \"{current}/{total}\",\n",
       "            \"pageIconColor\": \"#2f4554\",\n",
       "            \"pageIconInactiveColor\": \"#aaa\",\n",
       "            \"pageIconSize\": 15,\n",
       "            \"animationDurationUpdate\": 800,\n",
       "            \"selector\": false,\n",
       "            \"selectorPosition\": \"auto\",\n",
       "            \"selectorItemGap\": 7,\n",
       "            \"selectorButtonGap\": 10\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"enterable\": false,\n",
       "        \"confine\": false,\n",
       "        \"appendToBody\": false,\n",
       "        \"transitionDuration\": 0.4,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5,\n",
       "        \"order\": \"seriesAsc\"\n",
       "    },\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"text\": \"bilibili\\u756a\\u5267\\u5173\\u952e\\u5b57\",\n",
       "            \"target\": \"blank\",\n",
       "            \"subtarget\": \"blank\",\n",
       "            \"left\": \"10%\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"textAlign\": \"auto\",\n",
       "            \"textVerticalAlign\": \"auto\",\n",
       "            \"triggerEvent\": false\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "        chart_dcb7aa1dc87b4eb09f84a1c6be9dc04f.setOption(option_dcb7aa1dc87b4eb09f84a1c6be9dc04f);\n",
       "    </script>\n",
       "</body>\n",
       "</html>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x1ce5e5dd180>"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "cloudObj.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "542ee86501d26b57",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-17T10:28:31.432813100Z",
     "start_time": "2024-05-17T10:28:31.400307200Z"
    },
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1711    1928\n",
      "166     1940\n",
      "3270    1963\n",
      "2747    1969\n",
      "2813    1969\n",
      "        ... \n",
      "471     2024\n",
      "143     2024\n",
      "461     2024\n",
      "2540    2024\n",
      "3700    2024\n",
      "Name: 年份, Length: 3701, dtype: object\n"
     ]
    }
   ],
   "source": [
    "res = df.sort_values(by=\"年份\")\n",
    "print(res['年份'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "57008fbefc777f6",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-17T10:28:32.612055100Z",
     "start_time": "2024-05-17T10:28:32.573718200Z"
    },
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "633d3e2fa8eee0fc",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-17T10:28:33.685205300Z",
     "start_time": "2024-05-17T10:28:33.655216Z"
    },
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[233834, 47808, 372295], [439989, 51626, 538075], [453078, 102347, 548364], [330146, 108096, 886103], [639508, 224781, 1284704], [87507, 14588, 99251], [235156, 23966, 257012], [115830, 116159, 318982], [102238, 32008, 149454], [464690, 179072, 867309]]\n"
     ]
    }
   ],
   "source": [
    "s = df.sort_values(by=\"播放\", ascending=False).head(10)\n",
    "\n",
    "s_like = s[\"点赞\"].values.tolist()\n",
    "s_title = s[\"标题\"].values.tolist()\n",
    "s_coin = s[\"投币数\"].values.tolist()\n",
    "s_favorite = s[\"收藏\"].values.tolist()\n",
    "# print(san_title, san_like, san_coin, san_favorite)\n",
    "s_data = [[i, j, k] for i, j, k in zip(s_coin, s_favorite, s_like)]\n",
    "print(s_data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6040e0e14a7aaa23",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-17T10:28:35.238039500Z",
     "start_time": "2024-05-17T10:28:35.203330100Z"
    },
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "d038e3e49c3cab13",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-17T10:28:46.271578200Z",
     "start_time": "2024-05-17T10:28:46.256575400Z"
    },
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1    3645\n",
      "0      56\n",
      "Name: count, dtype: int64\n",
      "3645 3701 0.9848689543366658\n"
     ]
    }
   ],
   "source": [
    "# 统计完结的番剧占比\n",
    "res = df[\"是否完结\"].values.tolist()\n",
    "series = pandas.Series(res)\n",
    "counts = series.value_counts()\n",
    "print(counts)\n",
    "dic = counts.to_dict()\n",
    "# print(dic)\n",
    "\n",
    "finish = dic[1]\n",
    "all_is_finish = dic[0] + finish\n",
    "finish_percent = finish / all_is_finish\n",
    "print(finish, all_is_finish, finish_percent)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "191d0420c4b35721",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-17T10:28:46.951065300Z",
     "start_time": "2024-05-17T10:28:46.926059700Z"
    },
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [
    {
     "data": {
      "application/javascript": [
       "new Promise(function(resolve, reject) {\n",
       "    var script = document.createElement(\"script\");\n",
       "    script.onload = resolve;\n",
       "    script.onerror = reject;\n",
       "    script.src = \"https://assets.pyecharts.org/assets/v5/echarts.min.js\";\n",
       "    document.head.appendChild(script);\n",
       "}).then(() => {\n",
       "new Promise(function(resolve, reject) {\n",
       "    var script = document.createElement(\"script\");\n",
       "    script.onload = resolve;\n",
       "    script.onerror = reject;\n",
       "    script.src = \"https://assets.pyecharts.org/assets/v5/echarts-liquidfill.min.js\";\n",
       "    document.head.appendChild(script);\n",
       "}).then(() => {\n",
       "\n",
       "});\n",
       "});"
      ],
      "text/plain": [
       "<pyecharts.render.display.Javascript at 0x1ce5e39a2f0>"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\n",
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Liquid\n",
    "\n",
    "# 创建 Liquid 对象\n",
    "liquid = Liquid()\n",
    "# 添加数据\n",
    "liquid.add(\"Liquid\", [finish_percent])\n",
    "\n",
    "# 设置全局配置选项\n",
    "liquid.set_global_opts(\n",
    "    title_opts=opts.TitleOpts(title='Bilibili完结番剧占比', subtitle='', pos_left=\"10%\")\n",
    ")\n",
    "\n",
    "# 在 Jupyter Notebook 中直接显示图表\n",
    "liquid.load_javascript()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "ae90bae9bdf72bd5",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-17T10:28:47.893481300Z",
     "start_time": "2024-05-17T10:28:47.857974100Z"
    },
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<!DOCTYPE html>\n",
       "<html>\n",
       "<head>\n",
       "    <meta charset=\"UTF-8\">\n",
       "</head>\n",
       "<body>\n",
       "        <div id=\"78b3efb5781a40089b0803eb0325a4d9\" class=\"chart-container\" style=\"width:900px; height:500px; \"></div>\n",
       "    <script>\n",
       "        var chart_78b3efb5781a40089b0803eb0325a4d9 = echarts.init(\n",
       "            document.getElementById('78b3efb5781a40089b0803eb0325a4d9'), 'white', {renderer: 'canvas'});\n",
       "        var option_78b3efb5781a40089b0803eb0325a4d9 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"aria\": {\n",
       "        \"enabled\": false\n",
       "    },\n",
       "    \"color\": [\n",
       "        \"#5470c6\",\n",
       "        \"#91cc75\",\n",
       "        \"#fac858\",\n",
       "        \"#ee6666\",\n",
       "        \"#73c0de\",\n",
       "        \"#3ba272\",\n",
       "        \"#fc8452\",\n",
       "        \"#9a60b4\",\n",
       "        \"#ea7ccc\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"liquidFill\",\n",
       "            \"name\": \"Liquid\",\n",
       "            \"data\": [\n",
       "                0.9848689543366658\n",
       "            ],\n",
       "            \"waveAnimation\": true,\n",
       "            \"animationDuration\": 2000,\n",
       "            \"animationDurationUpdate\": 1000,\n",
       "            \"color\": [\n",
       "                \"#294D99\",\n",
       "                \"#156ACF\",\n",
       "                \"#1598ED\",\n",
       "                \"#45BDFF\"\n",
       "            ],\n",
       "            \"shape\": \"circle\",\n",
       "            \"backgroundStyle\": {},\n",
       "            \"outline\": {\n",
       "                \"show\": true,\n",
       "                \"borderDistance\": 8\n",
       "            },\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"inside\",\n",
       "                \"margin\": 8,\n",
       "                \"fontSize\": 50\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [],\n",
       "            \"selected\": {},\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14,\n",
       "            \"backgroundColor\": \"transparent\",\n",
       "            \"borderColor\": \"#ccc\",\n",
       "            \"borderWidth\": 1,\n",
       "            \"borderRadius\": 0,\n",
       "            \"pageButtonItemGap\": 5,\n",
       "            \"pageButtonPosition\": \"end\",\n",
       "            \"pageFormatter\": \"{current}/{total}\",\n",
       "            \"pageIconColor\": \"#2f4554\",\n",
       "            \"pageIconInactiveColor\": \"#aaa\",\n",
       "            \"pageIconSize\": 15,\n",
       "            \"animationDurationUpdate\": 800,\n",
       "            \"selector\": false,\n",
       "            \"selectorPosition\": \"auto\",\n",
       "            \"selectorItemGap\": 7,\n",
       "            \"selectorButtonGap\": 10\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"enterable\": false,\n",
       "        \"confine\": false,\n",
       "        \"appendToBody\": false,\n",
       "        \"transitionDuration\": 0.4,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5,\n",
       "        \"order\": \"seriesAsc\"\n",
       "    },\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"text\": \"Bilibili\\u5b8c\\u7ed3\\u756a\\u5267\\u5360\\u6bd4\",\n",
       "            \"target\": \"blank\",\n",
       "            \"subtarget\": \"blank\",\n",
       "            \"left\": \"10%\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"textAlign\": \"auto\",\n",
       "            \"textVerticalAlign\": \"auto\",\n",
       "            \"triggerEvent\": false\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "        chart_78b3efb5781a40089b0803eb0325a4d9.setOption(option_78b3efb5781a40089b0803eb0325a4d9);\n",
       "    </script>\n",
       "</body>\n",
       "</html>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x1ce5e5dc7f0>"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "liquid.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f4de5e740735ce4",
   "metadata": {
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 218,
   "id": "593ba731b56a385",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-17T10:49:33.285385600Z",
     "start_time": "2024-05-17T10:49:33.263881300Z"
    },
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'D:\\\\he-project\\\\爬虫\\\\Test\\\\b站番剧\\\\html\\\\page.html'"
      ]
     },
     "execution_count": 218,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts.charts import Page\n",
    "\n",
    "# 创建page对象\n",
    "page = Page(layout=Page.DraggablePageLayout)\n",
    "page.add(bar1, bar2, cloudObj, pie,liquid)\n",
    "page.render(\"html/page.html\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "92005fb9239bd07f",
   "metadata": {
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "cbb70885a3d4b585",
   "metadata": {
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "df9c4341e1eba590",
   "metadata": {
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
